package com.cfushn.ddd.tools.string;


/**
 * ValuesBuilder
 *
 * @author CFuShn 2021/11/30 14:55
 */
@SuppressWarnings("unused")
public class ValuesBuilder extends LineBuilder<ValuesBuilder> {

    public ValuesBuilder append(Object s, boolean isValue) {

        if (s == null) {
            s = "null";
            isValue = false;
        }

        if (thisBuilder.length() == 0) {
            thisBuilder.append("\n(");
        } else {
            thisBuilder.append(",");
            if (isLineEnd) {
                thisBuilder.append("\n(");
            }
        }
        if (isValue) {
            thisBuilder.append("'").append(s).append("'");
        } else {
            thisBuilder.append(s);
        }
        isLineEnd = false;

        return this;
    }

    @Override
    public ValuesBuilder append(Object s) {
        return append(s, true);
    }
}
